<template>
  <div style="width: 100%; height: 100%">
    <vue-office-docx
      style="width: 100%; height: 100%"
      :src="fileUrl"
      @error="errorHandler"
      @rendered="renderedHandler"
    />
  </div>
</template>

<script>
import VueOfficeDocx from '@vue-office/docx';
import '@vue-office/docx/lib/index.css';

export default {
  name: 'WordPreview',
  components: {
    VueOfficeDocx
  },
  props: {
    fileUrl: {
      type: String
    }
  },
  methods: {
    errorHandler(error) {
      this.$emit('error', error);
    },
    renderedHandler() {
      this.$emit('success');
    }
  }
};
</script>

<style></style>
